<!DOCTYPE HTML>
<html>
<head>
<title>登陆入口</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="监控系统 Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
    Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href="/static/css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom Theme files -->
<style type="text/css">
    .login-search{
        height:11em;
    }
    .login-search-btn{
        margin: 0 50% 0  25%;  {# u r b l #}
    }
    .login-btn{
        {#margin: 0 0 0 35%;#}
        text-align: center;
    }

</style>

<link href="/static/css/style.css" rel='stylesheet' type='text/css' />
<link href="/static/css/font-awesome.css" rel="stylesheet"> 
<script src="/static/js/jquery.min.js"> </script>
<script src="/static/js/bootstrap.min.js"> </script>
<script type="text/javascript">
     function func(){
            return false;
        }
    $(function(){
        $("#login").hide();
        $('#p1').click(function () {
            $('#login').hide();
            $("#search").show();
        });
        $('#p2').click(function () {
            $('#search').hide();
            $('#login').show();
            $('h2').html('运输者登陆');
        });
        $('#p3').click(function () {
            $('#search').hide();
            $('#login').show();
            $('h2').html('商超登陆');
        });
        $('#p4').click(function () {
            $('#search').hide();
            $('#login').show();
            $('h2').html('监督机构登陆');
        });

        $('#search_btn').click(function () {
            var $search_text = $('#search_text').val();
           $.ajax({
               'url':'/ajax_signin_search_handle',
               'type':'post',
               'dataType':'json',
               'data':{'goodsId':$search_text}
           }).success(function (data) {
               // handle
               if (data.res == '0'){
                   alert('输入错误，请重新输入')
               }
               else{

                   var newUrl = '/consumers'+$search_text;
                   location.href = newUrl;
               }

          })

        });
        $('#signin_submit').click(function () {
            var $signin_count = $('#signin_count').val();
            var $signin_passwd = $('#signin_passwd').val();
           $.ajax({
               'url':'/ajax_signin_user_handle',
               'type':'post',
               'dataType':'json',
               'data':{'count':$signin_count,'pwd':$signin_passwd}
           }).success(function (data) {
               // handle
               if (data.res == '0'){
                   alert('用户名或密码错误，请重新输入')
               }
               else if(data.res == '1'){
                   var newUrl = ''

                   if ($('h2').html() == '运输者登陆' & data.userType == '1'){

                       newUrl = '/vehicle'+$signin_count;
                       {#alert($signin_count+$('h2').html()+$signin_count)#}
                       location.href = newUrl;
                   }
                   else if($('h2').html() == '商超登陆'& data.userType == '2'){
                       newUrl = '/supermaket'+$signin_count;
                       {#alert($signin_count+$('h2').html()+$signin_count)#}
                       location.href = newUrl;
                   }
                   else if($('h2').html() == '监督机构登陆'& data.userType == '3'){
                       newUrl = '/managers'+$signin_count;
                       {#alert($signin_count+$('h2').html()+$signin_count)#}
                       location.href = newUrl;
                   }
                   else{
                       alert("该用户不能登录")
                   }

               }

          });

        });
});
</script>
</head>
<body>
    <div class="but_list" id="chooseBtn">
        <p class="login-btn">
            <button type="button" class="btn btn-lg btn-default "  id="p1">  消费者&nbsp; </button>
            <button type="button" class="btn btn-lg btn-primary" id="p2"> 运输者&nbsp;</button>
            <button type="button" class="btn btn-lg btn-success warning_1" id="p3"> &nbsp;&nbsp;商超&nbsp;&nbsp;</button>
            <button type="button" class="btn btn-lg btn-warning warning_11"id ="p4">  监督机构  </button>
        </p>
    <!---->
    </div>
	<div class="login">
        <h1><a href="consumers.html">监控系统 </a></h1>
        <!---->
        <div class="login-bottom" id="login">
			<h2>登陆</h2>
			<form action="" onsubmit="return func()">
			<div class="col-md-6">
				<div class="login-mail">
					<input type="text" placeholder="账号" required="" id="signin_count">
					<i class="fa fa-envelope"></i>
				</div>
				<div class="login-mail">
					<input type="password" placeholder="密码" required="" id="signin_passwd">
					<i class="fa fa-lock"></i>
				</div>
				   <a class="news-letter " href="#">
						 <label class="checkbox1"><input type="checkbox" name="checkbox" ><i> </i>记住账户?</label>
                   </a>
			</div>
			<div class="col-md-6 login-do">
				<label class="hvr-shutter-in-horizontal login-sub">
					<input type="submit" value="登陆" id="signin_submit">
                </label>
                <p>新用户一定要更改密码!!</p>
				<a href="signup.html" class="hvr-shutter-in-horizontal">更改密码</a>
			</div>

			<div class="clearfix"> </div>
			</form>
		</div>

        <div class="login-bottom login-search" id="search" >
            <form  action="" onsubmit="return func()">
                <div class="col-md-12">
                    <div class="login-mail">
                        <input id='search_text'  name="goodsId"  type="text" placeholder="输入你要查询的商品编码...." required="">
                    </div>
                </div>
                <div class="col-md-6 login-do login-search-btn">
                    <label class="hvr-shutter-in-horizontal login-sub ">
                        <input id='search_btn' type="submit" value="搜索">
                    </label>
                </div>
            </form>
		</div>
	</div>
	<script src="/static/js/jquery.nicescroll.js"></script>
	<script src="/static/js/scripts.js"></script>

</body>
</html>

